package com.Home.Dao;

import com.Home.bean.User;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface UserDao extends CrudRepository<User, Integer>{
    User findByEmail(String email);
    List<User> findByName(String name);
    List<User> findByNameAndEmail(String name, String email);
    List<User> findByNameAndEmailOrderByIdDesc(String name,String email);//根据用户名和邮箱进行查询,排序
    //select * from test.users where email='imgod@qq.com' and name='imgod4444' order by id desc limit 2;
    List<User> findTop2ByNameAndEmailOrderByIdDesc(String name,String email);//根据用户名和邮箱进行查询,排序,前两个
    //根据邮箱进行分页查询
    List<User> findByEmail(String email,Pageable pageable);
}
